import re

import requests
headers = {
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:139.0) Gecko/20100101 Firefox/139.0',
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
    'Accept-Language': 'zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2',
    # 'Accept-Encoding': 'gzip, deflate, br, zstd',
    'Connection': 'keep-alive',
    'Referer': 'https://gjzwfw.www.gov.cn/fwmh/login/change.do?redirectUrlKey=965d8899100d478fb1214e229fe986e7',
    'Cookie': '_dec_key=undefined; CUSSESSIONID=YTIxYzFkZWQtMjQzOS00MjkzLWE2NDAtOTJiYzdmZTc2N2E0; CUSSESSIONID_=MTUwNWQ0NDEtNGY3NS00ODcyLWI2MWQtMzY5MWY1MDJhZWU1; https_waf_cookie=ca7b7ea9-3b8c-420c13c57dd33e9c76a4e2f23a8d8ed4796e; _dec_key=undefined; wdcid=7bd24cec13880089; wdlast=1761812291; wdses=7de697adbb51a638; __asc=98ea8ea619a341c2dc84f907615; __auc=98ea8ea619a341c2dc84f907615; JSESSIONID=A1D5B654F724F0C3D940FC3573121B88',
    'Upgrade-Insecure-Requests': '1',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Priority': 'u=0, i',
}
lists=[

'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520302009505654E452070914600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520321009515051B452070913600005.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520321009515051B452070913600007.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520321009515051B452070914600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520322009518375Y452070913600005.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520322009518375Y452070913600007.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_1152032300952023XU452070913600005.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_1152032300952023XU452070913600007.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_1152032300952023XU452070914600001.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_115203240095227371452070913600005.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_115203240095227371452070913600006.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_115203240095227371452070914600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520325009524054Y452070913600007.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520325009524054Y452070913600008.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520325009524054Y452070914600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520326009526594C452070913600004.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520326009526594C452070913600006.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520326009526594C452070914600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520328009530331T452070913600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520328009530331T452070913600005.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520328009530331T452070914600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520330009536143X452070913600017.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520382009856235A452070913600007.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520382009856235A452070913600008.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_11520382009856235A452070914600003.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_115203005771024150452070913600007.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_115203005771024150452070913600008.do',
'https://gjzwfw.www.gov.cn/fwmh/item/v3/item_115203005771024150452070914600003.do',

]
for i in lists:



    res=requests.get(
        headers=headers,
        url=i)


    # print(res.text)
    pattern = r'<span class=".*?">(受理条件)</span>.*?<div class="section_content">(.*?)</div>'
    # pattern2 = r'<span class="section_71">.*?>受理条件</td>.*?<td colspan="3">(.*?) </div>'

    # 提取内容并处理空白
    result = re.findall(pattern, res.text, re.DOTALL)
    # result2 = re.findall(pattern2, res.text, re.DOTALL)
    # print(result)
    if result:
        # 去除多余空格和换行
        content = re.sub(r'\s+', ' ', result[0][1]).strip()
        if "无"  in content:
            print(i+"异常")

